<template>
    <div>
        <Row style="margin:5px 0px 10px 5px">
            <i-col span="1" >
                <Button  size="default"  type="primary" @click="btn_refresh">刷新</Button>
            </i-col>
        </Row>
        <i-table size="default"   border stripe  :columns="format" :data="show_list" :height="sharedState.tableHeight" ></i-table >
    </div>
</template>

<script>

import { post } from  '@/api/http'
import { get_env_list } from  '@/api'
import store from '@/store'

export default {
    data() {
        return {
            sharedState: store.state,
            format: [
                {
                    title: '环境',key: 'name'
                },
                {
                    title: '集群',key: 'clusters'
                },
                {
                    title: '创建用户',key: 'create_user'
                },
                {
                    title: '创建时间',key: 'create_time'
                },
                // {
                //     title: '操作',slot: 'action',width: 200,align: 'center'
                // }
            ],
            show_list: [],
        }
    },
    methods: {
		btn_refresh(){
            this.refresh()
        },
        refresh() {
            post(get_env_list).then( (response) => {
                this.show_list = response.data
            })
        }
    },
    mounted: function() {
        setTimeout(() =>{
            this.refresh();
        },200); 
    }
}
</script>
<style scoped>

</style>